import request from '@/utils/request'

export function detail(goodsId) {
  return request({
    url: '/pp/goods/detail',
    method: 'get',
    params: { goodsId }
  })
}

export function add(data) {
  return request({
    url: '/pp/goods/add',
    method: 'post',
    data
  })
}

export function edite(data) {
  return request({
    url: '/pp/goods/edite',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: '/pp/goods/delete',
    method: 'post',
    params: { ids }
  })
}

export function postageUpdate(data) {
  return request({
    url: '/pp/goods/postage/update',
    method: 'post',
    data
  })
}

export function attrUpdate(data) {
  return request({
    url: '/pp/goods/attr/update',
    method: 'post',
    data
  })
}

export function skuUpdate(data) {
  return request({
    url: '/pp/goods/sku/update',
    method: 'post',
    data
  })
}

export function detailIntroUpdate(data) {
  return request({
    url: '/pp/goods/detailIntro/update',
    method: 'post',
    data
  })
}

export function categorizeUpdate(data) {
  return request({
    url: '/pp/goods/categorize/update',
    method: 'post',
    data
  })
}

export function getList(params) {
  return request({
    url: '/pp/goods/list',
    method: 'get',
    params
  })
}

export function statusSwitch(goodsId) {
  return request({
    url: '/pp/goods/status/switch',
    method: 'post',
    data: { goodsId }
  })
}
